package com.lk.mapper;

import com.lk.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {

    /**
     * 根据账号密码查询用户；登录
     * @param
     */
    @Select("select  * from tb_user where username=#{username} and password =#{password}")
    User select(@Param("username") String username,@Param("password") String password);


    /**
     * 添加用户；注册
     * @param
     */
    @Insert("insert into tb_user values (null,#{username},#{password})")
    void add(User user);


    /**
     * 根据用户名查找；判断注册时用户名是否存在
     * @param username
     * @return
     */
    @Select("select * from tb_user where username=#{username}")
    User selectByUsername(String username);

}
